<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
</head>
<body>
<div align="center">
    <?php
    require "include.php";
    $rs = new DBHelper();
    $res = $rs->fetch_all("SHOW COLUMNS FROM `{$_GET['type']}`");
    $sql = "select * from {$_GET['type']} where id={$_GET['id']}";
    $result = $rs->fetch_all($sql);
    $sl=mysqli_fetch_array($result);
    $rt = array();
    if ($res instanceof mysqli_result)
    {
        while (($row = $res->fetch_assoc()) != FALSE)
        {
            $row['CanBeNull'] = $row['Null'] === 'YES';   //字段值是否可以为空，是的话值为'YES'
            $rt[] = $row;
        }
    }
    $ss=count($rt);
    echo "<form action='api.php?act=update&type={$_GET['type']}&id={$_GET['id']}' method='post'>";
    echo '<h1>'.$_GET['type'].'</h1>';
    for ($i = 0; $i < $ss; $i++) {
        if($i>0){
            echo $rt[$i]['Field']."<input type='text' name={$rt[$i]['Field']} value={$sl[$i]}>";
            echo "<br>";
        }
    }
    echo '<input type="submit" value="提交">';
    echo '</form>';
    ?>
</div>
</body>
</html>